
public class NODsvclass
{
	public static int svoy(int a,int b)
	{
		int k=0;
		if(a>=b)
		{
			k=b;
		}
		else
		{
			k=a;
		}
			
		if(a%2==0 && b%2==0)
		{
			
			while(a%k!=0 || b%k!=0)
			{
				k=k-2;
			}
		}
		else
		{
			if(a%5==0 && b%5==0)
			{
				while(a%k!=0 || b%k!=0)
				{
					k=k-5
							;
				}
			}
			else
			{
				while(a%k!=0 || b%k!=0)
				{
					k=k-1;
				}
			}
		}
		return(k);
	}
	public static void main(String[] args) 
	{
		int j=30456;
		int i=2350;
		long start = System.nanoTime();
		System.out.println(svoy(j,i));
		long end = System.nanoTime();
		long traceTime = end-start;
		System.out.println(traceTime);

	}

}
